<include file="public@header"/>
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>资源列表</h5>
                    </div>
                    <php>$status=['不可用', '可用'];</php>
                    <div class="ibox-content">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>用户</th>
                                    <th>文件大小</th>
                                    <th>文件名</th>
                                    <th>图像</th>
                                    <th>文件路径</th>
                                    <th>状态</th>
                                    <th>{:lang('ACTIONS')}</th>
                                </tr>
                            </thead>
                            <tbody>
                                <php>
                                    $asset_img_suffixes=['bmp','jpg','jpeg','png','gif','tiff'];/*TODO ADD MORE*/
                                </php>
                                <foreach name="assets" item="vo">
                                    <tr>
                                        <td>{$vo.id}</td>
                                        <td>
                                            <span class="line">用户ID:{$vo.user_id} {$vo.user_login} {$vo.user_nickname}</span>
                                        </td>
                                        <td>{$vo.file_size/1024|round}KB</td>
                                        <td>{$vo.filename}</td>
                                        <td>
                                            <if condition="in_array(strtolower($vo['suffix']),$asset_img_suffixes)">
                                            <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo['file_path'])}');">
                                                <img width="25" height="25" src="{:cmf_get_image_url($vo['file_path'])}">
                                                </a>
                                            </if> 
                                                                <!-- <if condition="in_array(strtolower($vo['suffix']),$asset_img_suffixes)">
                                                                     <img width="25" height="25" src="{:cmf_get_image_url($vo['file_path'])}">
                                                                </if>  -->
                                        </td>
                                        <td>
                                            {$vo.file_path}
                                            <if condition="!file_exists('upload/'.$vo['file_path'])">
                                                <span style='color:red;'>&nbsp;&nbsp(文件丢失)</span>
                                            </if>
                                        </td>
                                        <td>{$status[$vo['status']]}</td>
                                        <td>
                                            <a href="{:url('AdminAsset/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                                        </td>
                                    </tr>
                                </foreach>
                            </tbody>
                        </table>
                        <div class="pagination">{$page|default=''}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>